<%--
  Created by IntelliJ IDEA.
  User: zhouh
  Date: 2022/6/6
  Time: 8:31
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>login</title>
    <script src="/static/layui/layui.js"></script>
    <link rel="stylesheet" href="/static/layui/css/layui.css">
    <style type="text/css">
        .container{
            width: 420px;
            height: 320px;
            min-height: 320px;
            max-height: 320px;
            position: absolute;
            top: 0;
            left: 0;
            bottom: 0;
            right: 0;
            margin: auto;
            padding: 20px;
            z-index: 130;
            border-radius: 8px;
            background-color: #fff;
            box-shadow: 0 3px 18px rgba(100, 0, 0, .5);
            font-size: 16px;
        }
        .close{
            background-color: white;
            border: none;
            font-size: 18px;
            margin-left: 410px;
            margin-top: -10px;
        }

        .layui-input{
            border-radius: 5px;
            width: 300px;
            height: 40px;
            font-size: 15px;
        }
        .layui-form-item{
            margin-left: -20px;
        }
        #logoid{
            margin-top: -16px;
            padding-left:150px;
            padding-bottom: 15px;
        }
        .layui-btn{
            margin-left: -50px;
            border-radius: 5px;
            width: 350px;
            height: 40px;
            font-size: 15px;
        }
        .verity{
            width: 120px;
        }
        .font-set{
            font-size: 13px;
            text-decoration: none;
            margin-left: 120px;
        }
        a:hover{
            text-decoration: underline;
        }
        h2{
            padding-bottom: 50px;
            text-align: center;
        }

    </style>
</head>
<body>
<%--登录--%>
<form class="layui-form" > <!-- 提示：如果你不想用form，你可以换成div等任何一个普通元素 -->
    <div class="container">
        <button class="close" title="关闭"></button>

        <h2>BBB后台管理系统</h2>
        <div class="layui-form-item">
            <label class="layui-form-label">用户名</label>
            <div class="layui-input-block">
                <input type="text" name="username"   lay-verify="required" placeholder="请输入用户名" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">密码</label>
            <div class="layui-input-block">
                <input type="password" name="password" lay-verify="required"   placeholder="请输入密码" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="loginDemo">登录</button>
            </div>
        </div>
    </div>
</form>
<%--登录--%>
<script>
    layui.use(['jquery', 'form', 'table'], function () {
        var table = layui.table;
        var form = layui.form;
        $ = layui.$;
        form.on('submit(loginDemo)', function (data) {
            $.ajax({
                url: "/userinfo/login?mothed=login",
                type: "POST",
                dataType: "JSON",
                data: data.field,
                success: function (ret) {
                    if (ret.code === 0) {
                        window.location.href="/userinfo/html/show.jsp";
                    }else if (ret.code === 1){
                        layer.alert(ret.msg)
                    }

                }
            });
            return false;
        });
        // 搜索表单重置
        $("#search_reset").click(function () {
            table.reload('userList', {
                where: { //请求参数（注意：这里面的参数可任意定义，并非下面固定的格式）
                    searchstudentid: "" //第一个查询条件
                    , searchstudentname: ""//第二个查询条件
                },
                page: {
                    curr: 1 //重新从第 1 页开始
                },
            });
        });

    })
</script>

</body>
</html>
